package org.study;

import test.HelloDemo;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public class DemoClassLoader extends URLClassLoader {


    public DemoClassLoader(URL[] urls, ClassLoader parent) {
        super(urls, parent);
    }

    public static void main(String[] args) throws MalformedURLException, ClassNotFoundException {
        URL[] urls = new URL[1];
        URL url = new URL( "file:~/javaproj/study/sourcecode/src/demo-class/");
        urls[0] = url;
        DemoClassLoader demo = new DemoClassLoader(urls, null);
        Class<?> aClass1 = demo.findClass("HelloDemo");
        Class<?> aClass = Class.forName("HelloDemo", true, demo);
        System.out.println(aClass);
    }

}
